<%-- 
    Document   : index
    Created on : Dec 31, 2011, 6:29:36 PM
    Author     : user
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">


<%@include file="../jspf/header.jspf" %>
<div>
    <div class="divContent">
        <p class="pageTitle"><strong>Cos de cumparaturi</strong></p>
        <br />
        <div class="pageSubTitle" style="width: 100%"><b>Produse comandate</b>
            <hr />
        </div>

        <form id="frmCart" name="frmCart" method="post"
              action="cart?action=clear">

            <%@include file="../jspf/message.jspf" %>


            <%
                        if (session.getAttribute(Static.cart) == null) {
                            out.println("<div id=\"svr_success\"><p>Cosul este gol </p></div>");
                        } else {
                            ArrayList products = (ArrayList) session.getAttribute(Static.cart);
                            int s = products.size();

                            for (int i = 0; i < s; i++) {
                                HashMap p = (HashMap) products.get(i);


                                out.println("<div id=\"div_" + p.get("ProductID") + "\" class=\"divProduct\" >");
                                out.println("<div class=\"divContentPicture\">");
                                out.println("<div class=\"divPictureProduct\"><img	src=\"img/products/");

                                String photo = (String) p.get("Photo");
                                if (photo.isEmpty()) {
                                    out.println("imagenotfound.jpg");
                                } else {
                                    out.println(photo);
                                }
                                out.println("\" width=\"150px\" height=\"120px\" alt=\"?\" /></div></div>");
                                out.println("<div class=\"divContentProduct\"><div class=\"divProductDetails txt3\">");
                                out.println("<div><b>" + p.get("Name") + "</b></div>");
                                out.println("<div><b>Pret: <label id=\"price_" + p.get("ProductID") + "\">" + p.get("Price") + "</label></b></div>");
                                out.println("<div id=\"div_quantity_" + p.get("ProductID") + "\"><b>Cantitati comandate: </b> <input type=\"text\" id=\"quantity_" + p.get("ProductID") + "\" onkeyup=\" CheckQuantity(" + p.get("ProductID") + "\")\" name=\"quantity_" + p.get("ProductID") + "\" size=\"32\" maxlength=\"10\" value=\"" + p.get("Quantity") + "\" class=\"tbProductQuantity txt3\" />");
                                out.println("<img title=\"Actualizeaza cantitate\" onclick=\" UpdateProductQuantity(" + p.get("ProductID") + ")\" src=\"img/site/update_btn.png\" style=\"margin:2 0 0 5 ;width:20px; height: 20px;cursor:pointer\"/></div>");
                                out.println("<div id=\"div_sub_" + p.get("ProductID") + "\" ><b >Subtotal: " + Float.parseFloat(p.get("Price").toString()) * Float.parseFloat(p.get("Quantity").toString()) + "</b></div>");
                                out.println("<div><b><img onclick=\"deleteProduct(" + p.get("ProductID") + ")\" src=\"img/site/delete_btn.png\" style=\"width:20px; height: 20px;cursor:pointer\"/>  Sterge produs</b></div>");
                                out.println("</div></div><div style=\"width: 100%; float: left;\"><hr /></div></div>");
                            }
                        }

            %>
            <div style="float: left;"><input name="confirmButton" type="submit" class="button" value="Goleste cos" title="Goleste cos" /></div>
        </form>
    </div>
</div>
<%@include file="../jspf/footer.jspf" %>